package com.alkaid.commons.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import org.hibernate.validator.constraints.Range;
import org.springframework.stereotype.Component;

import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author Kylin
 */
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Data
@Component
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "t_user")
public class User extends BaseEntity implements Serializable {
    /**
     * 用户ID
     */
    @TableId
    private Long id;
    /**
     * 用户名
     */
    private String username;
    /**
     * 密码
     */
    private String password;
    /** 昵称 */
    @Pattern(regexp = "\\S{2,16}", message = "昵称长度必须为2-16个字符，且不能包含空白字符")
    private String nickname;
    /**
     * 头像
     */
    private String avatar;
    /**
     * 经验
     */
    private Integer exp;
    /**
     * 经验上限
     */
    @TableField(exist = false)
    private Integer totalExp;
    /**
     * 等级
     */
    @TableField(exist = false)
    private Integer lev;
    /**
     * 硬币
     */
    private Float coins;
    /**
     * 钻石
     */
    private Integer diamonds;
    /** 性别 */
    @Range(min = 0, max = 2, message = "性别参数不合法")
    private Integer sex;
    /**
     * 称号
     */
    private Integer tag;
    /**
     * 我的签名
     */
    private String signature;
    /**
     * 生日
     */
    private Date birth;
    /**
     * 状态
     */
    private Integer status;
    /**
     * 权限列表
     */
    @TableField(exist = false)
    private List<Authority> authorities;
    @TableField(exist = false)
    private Date vipExpiredTime;
}
